﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Shared/MasterHome.master" AutoEventWireup="true"
    CodeFile="SreachResul.aspx.cs" Inherits="SreachResul" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<style type"text/css">
    textarea
    {
        resize: none;
        border-style: none;
        background-color:White;    
    }
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
        <asp:View ID="View1" runat="server">
            <div>
                <table>
                    <tr>
                        <th>
                            Search
                        </th>
                    </tr>
                    <tr>
                        <td>
                            Category :
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlCate" runat="server" DataTextField="cName"
                                DataValueField="cId" onselectedindexchanged="ddlCate_SelectedIndexChanged">
                                <asp:ListItem Selected="True">Default</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Name
                        </td>
                        <td>
                            <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
                        </td>
                        <td>
                        </td>
                        <td>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Production code
                        </td>
                        <td>
                            <asp:TextBox ID="txtCode" runat="server" Width="203px"></asp:TextBox>
                        </td>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Description
                        </td>
                        <td>
                            <asp:TextBox ID="txtDes" runat="server" Height="61px" TextMode="MultiLine" Width="207px"></asp:TextBox>
                        </td>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Between price
                        </td>
                        <td>
                            <asp:TextBox ID="txtPriceMin" runat="server"></asp:TextBox>
                            <asp:TextBox ID="txtPriceMax" runat="server"></asp:TextBox>
                        </td>
                        <td>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Button ID="Button1" runat="server" Text="Search" OnClick="Button1_Click" />
                        </td>
                    </tr>
                </table>
            </div>
        </asp:View>
        <asp:View ID="View2" runat="server">
            <div>
                <asp:ListView ID="ListView1" runat="server" 
                    GroupItemCount="3" onitemcommand="ListView1_ItemCommand">
                    <AlternatingItemTemplate>
                                               <td id="Td1" runat="server" style="background-color:#DCDCDC;color: #000000;">
                            
                            <asp:Image ID="Image1" runat="server"  ImageUrl='<%# Eval("pSmallImage" ,"~/ImageProduct/{0}" ) %>' Height="100px"  Width="100px"/>
                            <br />
                            ProductCode:
                            <asp:Label ID="pProductCodeLabel" runat="server" 
                                Text='<%# Eval("pProductCode") %>' />
                            <br />
                            Name:
                            <asp:Label ID="pNameLabel" runat="server" Text='<%# Eval("pName") %>' />
                            <br />
                            Price:
                            <asp:Label ID="pPriceLabel" runat="server" Text='<%# Eval("pPrice") %>' />
                            <br />
                            <asp:LinkButton ID="LinkButton1" runat="server" PostBackUrl='<%# Eval("pProductCode" , "DetailsProduct.aspx?pCode={0}") %>'>Details</asp:LinkButton>
                            <asp:Button ID="btnAddToCart" runat="server" Text="Add to Cart" CommandName="Add" />
                            <br />
                        </td>
                    </AlternatingItemTemplate>
        
                    <EditItemTemplate>
                        <td runat="server" style="background-color:#008A8C;color: #FFFFFF;">
                            pProductCode:
                            <asp:TextBox ID="pProductCodeTextBox" runat="server" 
                                Text='<%# Bind("pProductCode") %>' />
                            <br />
                            pSmallImage:
                            <asp:TextBox ID="pSmallImageTextBox" runat="server" 
                                Text='<%# Bind("pSmallImage") %>' />
                            <br />
                            pPrice:
                            <asp:TextBox ID="pPriceTextBox" runat="server" Text='<%# Bind("pPrice") %>' />
                            <br />
                            pName:
                            <asp:TextBox ID="pNameTextBox" runat="server" Text='<%# Bind("pName") %>' />
                            <br />
                            <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                                Text="Update" />
                            <br />
                            <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                                Text="Cancel" />
                            <br />
                        </td>
                    </EditItemTemplate>
                    <EmptyDataTemplate>
                        <table runat="server" 
                            style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;">
                            <tr>
                                <td>
                                    No data was returned.</td>
                            </tr>
                        </table>
                    </EmptyDataTemplate>
                    <EmptyItemTemplate>
                        <td runat="server" />
                    </EmptyItemTemplate>
                    <GroupTemplate>
                        <tr ID="itemPlaceholderContainer" runat="server">
                            <td ID="itemPlaceholder" runat="server">
                            </td>
                        </tr>
                    </GroupTemplate>
               
                    <ItemTemplate>
                        <td runat="server" style="background-color:#DCDCDC;color: #000000;">
                            
                            <asp:Image ID="Image1" runat="server"  ImageUrl='<%# Eval("pSmallImage" ,"~/ImageProduct/{0}" ) %>' Height="100px"  Width="100px"/>
                            <br />
                            ProductCode:
                            <asp:Label ID="pProductCodeLabel" runat="server" 
                                Text='<%# Eval("pProductCode") %>' />
                            <br />
                            Name:
                            <asp:Label ID="pNameLabel" runat="server" Text='<%# Eval("pName") %>' />
                            <br />
                            Price:
                            <asp:Label ID="pPriceLabel" runat="server" Text='<%# Eval("pPrice") %>' />
                            <br />
                            <asp:LinkButton ID="LinkButton1" runat="server" PostBackUrl='<%# Eval("pProductCode" , "DetailsProduct.aspx?pCode={0}") %>'>Details</asp:LinkButton>

                            <asp:Button ID="btnAddToCart" runat="server" Text="Add to Cart" CommandName="Add" />
                            <br />
                        </td>
                    </ItemTemplate>
                    <LayoutTemplate>
                        <table runat="server">
                            <tr runat="server">
                                <td runat="server">
                                    <table ID="groupPlaceholderContainer" runat="server" border="1" 
                                        style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;">
                                        <tr ID="groupPlaceholder" runat="server">
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr runat="server">
                                <td runat="server" 
                                    style="text-align: center;background-color: #CCCCCC;font-family: Verdana, Arial, Helvetica, sans-serif;color: #000000;">
                                    <asp:DataPager ID="DataPager1" runat="server" PageSize="12">
                                        <Fields>
                                            <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" 
                                                ShowLastPageButton="True" />
                                        </Fields>
                                    </asp:DataPager>
                                </td>
                            </tr>
                        </table>
                    </LayoutTemplate>
           
                  
                </asp:ListView>
                <asp:Button ID="Button2" runat="server" Text="Search" 
                    onclick="Button2_Click" />
                <%--<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ShopConnectionString %>"
            SelectCommand="SELECT * FROM [Products]"></asp:SqlDataSource>--%>
                <br />
                <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ShopConnectionString %>"
                    SelectCommand="SELECT [cId], [cName] FROM [Categories]"></asp:SqlDataSource>
                <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:ShopConnectionString %>" 
                    SelectCommand="SELECT [pProductCode], [pSmallImage], [pPrice], [pName] FROM [Products]">
                </asp:SqlDataSource>
            </div>
        </asp:View>
    </asp:MultiView>
    </asp:Content>
